/*
泛型接口
*/
class User {
    constructor(name, age) {
        this.name = name;
        this.age = age;
    }
}
class UserCRUD {
    constructor() {
        this.data = [];
    }
    add(item) {
        item.id = Date.now();
        this.data.push(item);
        return item.id;
    }
    getById(id) {
        return this.data.find(item => item.id === id);
    }
}
const userCRUD = new UserCRUD();
userCRUD.add(new User('A', 12));
const id = userCRUD.add(new User('B', 13));
console.log(userCRUD.data);
console.log(userCRUD.getById(id));
